package com.etymgiko.spaceshipshop.dao;

import com.etymgiko.spaceshipshop.model.SpaceShip;

import java.util.List;

/**
 * Dao to work with Spaceship object.
 *
 * @author Ivan Holub
 */
public interface SpaceShipDao {

    /**
     * Gets spaceship by id.
     *
     * @param id the id
     * @return {@link SpaceShip} instance
     */
    SpaceShip getSpaceShip(Long id);

    /**
     * Saves spaceship.
     *
     * @param spaceShip {@link SpaceShip} instance
     */
    void saveSpaceShip(SpaceShip spaceShip);

    /**
     * Finds spaceships.
     *
     * @param userId the owner id
     * @param filter the filter, string that fields name, typename or manufacturer can contain
     * @param pageNumber the page nu,ber
     * @return {@link List<SpaceShip>} instance
     */
    List<SpaceShip> findSpaceShips(Long userId, String filter, int pageNumber);

    /**
     * Finds count of spaceships.
     *
     * @param userId the owner id
     * @param filter the filter, string that fields name, typename or manufacturer can contain
     * @return long, count of spaceships
     */
    long findSpaceShipsCount(Long userId, String filter);

}
